home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / snws190s.zip / DEFS.H < prev    next >
C/C++ Source or Header  |  1992-06-21  |  6KB  |  176 lines

  1. /*
  2.     SNEWS 1.90α
  3.  
  4.     DEFS.H
  5.  
  6.     General public decls
  7.  
  8.  
  9.     Copyright (C) 1991  John McCombs, Christchurch, NEW ZEALAND
  10.                         john@ahuriri.gen.nz
  11.                         PO Box 2708, Christchurch, NEW ZEALAND
  12.  
  13.     This program is free software; you can redistribute it and/or modify
  14.     it under the terms of the GNU General Public License, version 1, as
  15.     published by the Free Software Foundation.
  16.  
  17.     This program is distributed in the hope that it will be useful,
  18.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20.     GNU General Public License for more details.
  21.  
  22.     See the file COPYING, which contains a copy of the GNU General
  23.     Public License.
  24.  
  25.  */
  26.  
  27. #include <alloc.h>
  28. #include <time.h>
  29. #include <string.h>
  30. #include <conio.h>
  31. #include <dos.h>
  32. #include <stdio.h>
  33. #include <stdlib.h>
  34. #include <string.h>
  35. #include <sys/stat.h>
  36. #include <dir.h>
  37.  
  38.  
  39. #define VERSION      "Simple NEWS 1.90α"
  40.  
  41. #define HIST_MEM_LIMIT  75000l  /* leave this much meme free loading history */
  42.  
  43. #define ACTIVE_NUM_LEN   8      /* length of the numbers in the active file */
  44.  
  45. #define TRUE     1
  46. #define FALSE    0
  47.  
  48. /* this is the data we get from the UUPC .rc files */
  49.  
  50. typedef struct {
  51.     char temp_name[80];           /* unbatch temp file             */
  52.     char temp_str[80];          /* Temporary dir display str     */
  53.     char news_dir[80];            /* news base directory           */
  54.     char incoming_dir[80];        /* incoming news spool directory */
  55.     char user[80];                /* current user id               */
  56.     char my_name[80];             /* my full name                  */
  57.     char my_domain[80];           /* our domain                    */
  58.     char my_site[80];             /* site name                     */
  59.     char my_organisation[80];     /* organisation                  */
  60.     char replyuser[80];           /* Reply-To User address         */
  61.     char replydomain[80];         /* Reply-To User domain          */
  62.     char mail_server[80];         /* where posts are routed to     */
  63.     char editor[80];              /* system editor                 */
  64.     char home[80];                /* home mail directory           */
  65.     char signature[80];           /* signature file                */
  66.     char alias_file[80];          /* alias file                    */
  67. } INFO;
  68.  
  69.  
  70. /* NOTE - if hi_num and lo_num are the same there are no articles */
  71.  
  72. typedef struct active {
  73.     char   group[60];           /* group name                               */
  74.     char   gp_file[9];          /* name of the file that the data is in     */
  75.     long   lo_num;              /* lowest number less one                   */
  76.     long   hi_num;              /* highest number                           */
  77.     long   num_pos;             /* file offset of the numbers               */
  78.     struct active *next;        /* next entry                               */
  79.     struct active *last;        /* last entry                               */
  80.     int    index;               /* which number in the list, from 0         */
  81.     char   *read_list;          /* array hi_num-lo_num long. TRUE=read it   */
  82. } ACTIVE;
  83.  
  84.  
  85.  
  86. /*
  87.  *  This singly linked list is used to store the names of the groups
  88.  *  we can post to.
  89.  */
  90.  
  91. typedef struct post_groups {
  92.     char   group[60];           /* group name                               */
  93.     struct post_groups *next;   /* next entry                               */
  94. } POST_GROUPS;
  95.  
  96.  
  97. /*
  98.  *  READ LIST:
  99.  *      The list of articles which has been seen by a user is kept in an
  100.  *      ascii file, which has a newsgroup name followed by the list
  101.  *      of article numbers which have been seen.
  102.  *
  103.  *      The file is read by 'load_read_list', which allocates and array of
  104.  *      flags, one per article, and plugs these into the ACTIVE structure.
  105.  *      The flags are set to TRUE when a user has seen an article.
  106.  *
  107.  *      On shutdown a new 'user.nrc' file is written
  108.  */
  109.  
  110. /*
  111.  *  This structure is an index to the history file.  'mid' is a 32bit hash
  112.  *  of the message id.  'offset' is the offset into the history file, and
  113.  *  'next' makes the linked list
  114.  */
  115.  
  116. typedef struct hist_list {
  117.     long mid;
  118.     long offset;
  119.     struct hist_list *next;
  120. } HIST_LIST;
  121.  
  122.  
  123. /*
  124.  *  This linked list is returned by 'look_up_history'.  It is a list
  125.  *  of the groups to which an article has been crossposted.  It does
  126.  *  not include self
  127.  */
  128.  
  129. typedef struct cross_posts {
  130.     char   group[60];            /* group name                               */
  131.     long   art_num;              /* article number in this group             */
  132.     struct cross_posts *next;    /* next entry                               */
  133. } CROSS_POSTS;
  134.  
  135. extern INFO my_stuff;
  136.  
  137. #ifndef ACTIVE_C
  138.  
  139. extern int textb, textf, headb, headf, helpf, helpb, msgf, msgb;
  140.  
  141. #endif
  142.  
  143.  
  144. ACTIVE *load_active_file(void);
  145. void close_active_file(void);
  146. void close_active(void);
  147. ACTIVE *find_news_group(char *group);
  148. void update_active_entry(ACTIVE *a);
  149. char *make_news_group_name(char *ng);
  150.  
  151. void save_read_list(void);
  152. void load_read_list(void);
  153.  
  154. int load_stuff(void);
  155.  
  156. FILE *open_out_file(char *ng);
  157. FILE *open_index_file(char *ng);
  158.  
  159. int post_sequence(void);
  160.  
  161. void *xmalloc(size_t size);
  162.  
  163. int check_valid_post_group(char *ng);
  164.  
  165. void free_ng(void);
  166.  
  167. FILE *open_hist_file(void);
  168. void close_hist_file(void);
  169. void add_hist_record(char *msg_id, char *ng);
  170.  
  171. HIST_LIST *load_history_list(void);
  172. void free_hist_list(void);
  173. HIST_LIST *find_msg_id(char *msg_id);
  174. CROSS_POSTS *look_up_history(char *msg_id, char *ng);
  175. void free_cross_post_list(CROSS_POSTS *cx);
  176.